package com.rf.richfitwheel.common.enums;

import org.springframework.http.HttpStatus;

/**
 * @Title       :
 * @Description : 状态码枚举类
 * @Author      : GaoHuiMin
 * @Pate        : 2021/9/11 16:09
 * @Param       :
 * @return      :
 **/
public enum ResultStatus {

	SUCCESS(HttpStatus.OK, 0, "success"),
	SUCCESS_ADD(HttpStatus.OK, 0, "新增成功！"),
	SUCCESS_UPDATE(HttpStatus.OK, 0, "编辑成功！"),
	SUCCESS_DELETE(HttpStatus.OK, 0, "删除成功！"),

	FAILURE(HttpStatus.OK, -1, "failure"),
	FAILURE_ADD(HttpStatus.OK, -1, "新增失败,请联系管理员！"),
	FAILURE_ADD_ALREADY_EXiSTS(HttpStatus.OK, -1, "数据已存在，新增失败！"),

	FAILURE_UPDATE_NO_EXISTS(HttpStatus.OK, -1, "数据已存在,编辑失败！"),
	FAILURE_UPDATE(HttpStatus.OK, -1, "编辑失败,请联系管理员！"),

	FAILURE_DELETE(HttpStatus.OK, -1, "删除失败！"),
	FAILURE_DELETE_HAVE_SUB(HttpStatus.OK, -1, "删除失败，该节点存在子集数据，请先删除子集数据！"),

	FAILURE_VALIDATE(HttpStatus.OK, -1, "入参校验失败"),

	// FAILURE(HttpStatus.FAILED_DEPENDENCY, -1, "failure"),
	BAD_REQUEST(HttpStatus.BAD_REQUEST, -1, "Bad Request"),
	INTERNAL_SERVER_ERROR(HttpStatus.OK, -1, "failure"),
	// INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, -1, "failure"),
	// INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, 500, "Internal Server Error"),
	PARAM_ERRO(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE, 416, "Error in request parameters");
	
	/** 返回的HTTP状态码, 符合http请求 */
	private HttpStatus httpStatus;
	/** 业务异常码 */
	private Integer code;
	/** 业务异常信息描述 */
	private String message;

	ResultStatus(HttpStatus httpStatus, Integer code, String message) {
		this.httpStatus = httpStatus;
		this.code = code;
		this.message = message;
	}

	public HttpStatus getHttpStatus() {
		return httpStatus;
	}

	public Integer getCode() {
		return code;
	}

	public String getMessage() {
		return message;
	}

}
